package dolf.objects.weapons.Medipack;

import javax.swing.ImageIcon;

import dolf.objects.ImageStore;
import dolf.objects.weapons.*;
import dolf.window.SystemMessagesHandler;
import dolf.game.Player;
import dolf.game.Level;

public class Medipack implements Weapon, java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static final int Price = 50;
	public static final String Name = SystemMessagesHandler.getInstance().getMessages("dolf.objects.weapons.Medipack.lang.lang").getString("name");
	public static final String WeaponType = SystemMessagesHandler.getInstance().getMessages("dolf.objects.weapons.Medipack.lang.lang").getString("type");
	public static final String Description = SystemMessagesHandler.getInstance().getMessages("dolf.objects.weapons.Medipack.lang.lang").getString("description");
	public static final javax.swing.ImageIcon Icon = ImageStore.getInstance().getIcon("dolf/objects/weapons/Medipack/gfx/icon.png");
	
	
	private final int HEALTH = 20;
	private Player pl;
	private boolean used;
	private boolean inititalized = false;
	
	
	public Medipack(){
	}
	public void initialize(Player _pl){
		if(this.inititalized){
			return;
		}
		this.inititalized = true;
		this.pl = _pl;
		this.used = false;
		pl.setWeaponState();
	}
	
	public void deInitialize(){
		this.inititalized = false;
		this.pl = null;
	}
	
	public void execute() {
		if(Level.getInstance().mousePressed() && !this.used){
			this.pl.setHP(this.pl.getHP()+this.HEALTH);
			this.used = true;
			this.pl.setWeaponState();
		}
		
	}

	public ImageIcon getIcon() {
		return Icon;//ImageStore.getInstance().getIcon("dolf/objects/weapons/Medipack/gfx/icon.png");	

	}

	public String getName() {
		return Name;
		/*if (messages == null) loadProperties();
		return messages.getString("name");*/
	}
	
	public String getDescription() {
		return Description;
		/*if (messages == null) loadProperties();
		return messages.getString("description");*/
	}
	public String getType(){
		return WeaponType;
	}

	public int getPrice() {
		return Price;
	}

	public void remove() {
		pl.removeWeapon(this);
		this.pl.setAktWeapon(null);
	}
	public Player getPlayer(){
		return this.pl;
	}
	public double getState(){
		if(this.used){
			return 0;
		}else{
			return 1;
		}
	}
}
